package com.example.myapplication.ui.plus;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.MediaController;
import android.widget.VideoView;

import com.example.myapplication.R;

public class VideoActivity extends AppCompatActivity {
    VideoView mVideoNet;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        getSupportActionBar().hide();
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video);
        mVideoNet=findViewById(R.id.video_net);
        initNetVideo();
        Button btn1 = (Button)findViewById(R.id.button8);

        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(VideoActivity.this, com.example.myapplication.ui.home.MainActivity2.class);

                startActivity(intent);
            }
        });
    }


    //播放网络视频
    private void initNetVideo() {
        //设置有进度条可以拖动快进
        MediaController localMediaController = new MediaController(this);
        mVideoNet.setMediaController(localMediaController);
//        String url ="https://player.youku.com/embed/XNTE1MTA1NTc1Ng==";
//        String url ="https://v.youku.com/v_show/id_XNTE1MTA1NTc1Ng==.html";
        String url = "https://videocdn.taobao.com/oss/ali-video/d6bc4ae3eb3c866bee9903d47d1210c6/video.mp4";
        mVideoNet.setVideoPath(url);
        mVideoNet.start();
    }



}